{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">货物名称：</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$res['order_goods_name']}" name="order_goods_name" lay-verify="required" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">货物单位(吨)：</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$res['order_goods_ton']}" name="order_goods_ton" onkeyup="value=value.replace(/[^\d^\.]+/g,'')"lay-verify="required" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">货物单位(立方米)：</label>
                            <div class="layui-input-block">
                                <input type="text" value="{$res['order_goods_m']}" name="order_goods_m" onkeyup="value=value.replace(/[^\d^\.]+/g,'')"lay-verify="required" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">出发省：</label>
                            <div class="layui-input-block">
                                <select name="order_go_sheng" lay-search="" id="province"  lay-filter="province">
                                    {foreach name="province" item="vo"}
                                    <option value="{$vo.district_id}"{$vo.district_id == $res.order_go_sheng ? 'selected' : ''}>{$vo.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">出发市：</label>
                            <div class="layui-input-block">
                                <select name="order_go_shi" lay-search=""  id="city"  lay-filter="city">
                                    <option value="">---- 请选择市 ----</option>
                                    {foreach name='city' item='vo1'}
                                    <option value="{$vo1.district_id}" {$vo1.district_id == $res.order_go_shi ? 'selected' : ''}>{$vo1.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">出发区：</label>
                            <div class="layui-input-block">
                                <select name="order_go_qu" lay-search=""  id="district"  lay-filter="district">
                                    <option value="">---- 请选择区 ----</option>
                                    {foreach name='district' item='vo2'}
                                    <option value="{$vo2.district_id}" {$vo2.district_id == $res.order_go_qu ? 'selected' : ''}>{$vo2.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style="margin-top:50px">
                            <label class="layui-form-label">地址:</label>
                            <div class="layui-input-block">
                                <div id="container" style='width:90%;height:400px;z-index: 100;'></div>
                                <div id="myPageTop" style="margin-left: 150px;margin-top:10px;z-index:1000" >
                                    <table>
                                        <tr>
                                            <td>
                                                <label>请输入搜索内容</label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <input id="tipinput" class="dingwei" style="position: absolute;top: 0;right: -120px" placeholder="请输入地址"/>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">定位的地址:</label>
                            <div class="layui-input-block">
                                <table style="border-collapse:separate; border-spacing:5px;">
                                    <tr>
                                        <td>
                                            <input type="text" value="{$res.order_go_address}" name="order_go_address" class="match_addr" style="height:30px;width:500px" placeholder="详情地址" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <input type="text" value="{$res.order_go_lon}" readonly name="order_go_lon" class="match_lon" style="height:30px" placeholder="经度" />
                                        </td>
                                        <td>
                                            <input type="text" readonly value="{$res.order_go_lat}" name="order_go_lat" class="match_lat" style="margin-left:-250px;height:30px" placeholder="纬度" />
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">目的地省：</label>
                            <div class="layui-input-block">
                                <select name="order_to_sheng" lay-search="" id="provinceB"  lay-filter="provinceB">
                                    {foreach name="province" item="voo"}
                                    <option value="{$voo.district_id}" {$voo.district_id == $res.order_to_sheng ? 'selected' : ''}>{$voo.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">目的地市：</label>
                            <div class="layui-input-block">
                                <select name="order_to_shi" lay-search=""  id="cityB"  lay-filter="cityB">
                                    <option value="">---- 请选择市 ----</option>
                                    {foreach name="city" item="voo1"}
                                    <option value="{$voo1.district_id}" {$voo1.district_id == $res.order_to_shi ? 'selected' : ''}>{$voo1.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">目的地区：</label>
                            <div class="layui-input-block">
                                <select name="order_to_qu" lay-search=""  id="districtB"  lay-filter="districtB">
                                    <option value="">---- 请选择区 ----</option>
                                    {foreach name="district" item="voo2"}
                                    <option value="{$voo2.district_id}" {$voo2.district_id == $res.order_to_qu ? 'selected' : ''}>{$voo2.district}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8" style="margin-top:50px">
                            <label class="layui-form-label">地址:</label>
                            <div class="layui-input-block">
                                <div id="container1" style='width:90%;height:400px;z-index: 100;'></div>
                                <div id="myPageTop1" style="margin-left: 150px;margin-top:10px;z-index:1000" >
                                    <table>
                                        <tr>
                                            <td>
                                                <label>请输入搜索内容</label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <input id="tipinput1" class="dingwei" style="position: absolute;top: 0;right: -120px" placeholder="请输入地址"/>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">定位的地址:</label>
                            <div class="layui-input-block">
                                <table style="border-collapse:separate; border-spacing:5px;">
                                    <tr>
                                        <td>
                                            <input type="text" value="{$res['order_to_address']}" name="order_to_address" class="match_apply_addr" style="height:30px;width:500px" placeholder="详情地址"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <input type="text" value="{$res['order_to_lon']}" readonly name="order_to_lon" class="match_apply_lon" style="height:30px" placeholder="经度" />
                                        </td>
                                        <td>
                                            <input type="text" readonly value="{$res['order_to_lat']}" name="order_to_lat" class="match_apply_lat" style="margin-left:-250px;height:30px" placeholder="纬度"/>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">装车时间：</label>
                            <div class="layui-input-inline">
                                <input type="text" value="{$res['order_zc_time']}" name="order_zc_time" lay-verify="required"  class="layui-input test-item" >
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">装卸类型：</label>
                            <div class="layui-input-block">
                                <select name="zxlx_id" lay-search="" id="zxlx_id"  lay-filter="zxlx_id">
                                    {foreach name="zx" item="vv"}
                                    <option value="{$vv.zxlx_id}" {$vv.zxlx_id == $res.zxlx_id ? 'selected' : ''}>{$vv.zxlx_name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">货物类型：</label>
                            <div class="layui-input-block">
                                <select name="hwlx_id" lay-search="" id="hwlx_id"  lay-filter="zxlx_id">
                                    {foreach name="hw" item="vv1"}
                                    <option value="{$vv1.hwlx_id}" {$vv1.hwlx_id == $res.hwlx_id ? 'selected' : ''}>{$vv1.hwlx_name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">车型：</label>
                            <div class="layui-input-block">
                                <select name="cx_id"  xm-select="select2" xm-select-search="" xm-select-search-type="dl">
                                    {foreach name="cx" item="vv2"}
                                    <option value="{$vv2['cx_name']}" {if in_array($vv2['cx_name'],$res['cx_name'])} selected  {/if}>{$vv2['cx_name']}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">车长：</label>
                            <div class="layui-input-block">
                                <select name="order_cc"  xm-select="select3" xm-select-search="" xm-select-search-type="dl">
                                    {foreach name="cc" item="vv3"}
                                    <option value="{$vv3['cclb_name']}" {if in_array($vv3['cclb_name'],$res['cc_name'])} selected  {/if}>{$vv3['cclb_name']}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md10">
                            <label class="layui-form-label">货物照片</label>
                            <div class="layui-input-block">
                                <input type="hidden" name="del" id="del2" value="">
                                <input type="hidden" id="hid2" value="{$res.order_goods_img}">
                                <input type="hidden" name="photo" id="photo2" value="{$res.order_goods_img}">
                                <div id="uploader2" class="container-s">
                                    <div class="queueList">
                                        <div class="placeholder">
                                            <div id="filePicker2"></div>
                                            <p>或将照片拖到这里</p>
                                        </div>
                                    </div>
                                    <div class="statusBar" style="display:none;">
                                        <div class="layui-progress layui-progress-big active-s" lay-showpercent="true">
                                            <div class="layui-progress-bar layui-bg-blue" lay-percent="0%">
                                            </div>
                                            <span></span>
                                        </div>
                                        <div class="info"></div>
                                        <div class="btns">
                                            <div id="goPicker2" class="filePicker2"></div>
                                            <div class="uploadBtn">开始上传</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        {if $res['order_zc_goods_img']!=''}
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md10">
                            <label class="layui-form-label">装车照片</label>
                            <div class="layui-input-block">
                                <input type="hidden" name="del" id="del3" value="">
                                <input type="hidden" id="hid3" value="{$res.order_zc_goods_img}">
                                <input type="hidden" name="photo3" id="photo3" value="{$res.order_zc_goods_img}">
                                <div id="uploader3" class="container-s">
                                    <div class="queueList">
                                        <div class="placeholder">
                                            <div id="filePicker3"></div>
                                            <p>或将照片拖到这里</p>
                                        </div>
                                    </div>
                                    <div class="statusBar" style="display:none;">
                                        <div class="layui-progress layui-progress-big active-s" lay-showpercent="true">
                                            <div class="layui-progress-bar layui-bg-blue" lay-percent="0%">
                                            </div>
                                            <span></span>
                                        </div>
                                        <div class="info"></div>
                                        <div class="btns">
                                            <div id="goPicker3" class="filePicker2"></div>
                                            <div class="uploadBtn">开始上传</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        {/if}
                        {if $res['order_xh_goods_img']!=''}
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md10">
                            <label class="layui-form-label">卸货照片</label>
                            <div class="layui-input-block">
                                <input type="hidden" name="del" id="del4" value="">
                                <input type="hidden" id="hid4" value="{$res.order_xh_goods_img}">
                                <input type="hidden" name="photo4" id="photo4" value="{$res.order_xh_goods_img}">
                                <div id="uploader4" class="container-s">
                                    <div class="queueList">
                                        <div class="placeholder">
                                            <div id="filePicker4"></div>
                                            <p>或将照片拖到这里</p>
                                        </div>
                                    </div>
                                    <div class="statusBar" style="display:none;">
                                        <div class="layui-progress layui-progress-big active-s" lay-showpercent="true">
                                            <div class="layui-progress-bar layui-bg-blue" lay-percent="0%">
                                            </div>
                                            <span></span>
                                        </div>
                                        <div class="info"></div>
                                        <div class="btns">
                                            <div id="goPicker4" class="filePicker2"></div>
                                            <div class="uploadBtn">开始上传</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        {/if}
                        <input type="hidden" name="id" value="{$id}">
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=1e0d12c4fc7710d9c326e672ac6f26c2&plugin=AMap.Autocomplete,AMap.PlaceSearch,AMap.Geocode"></script>
<script type="text/javascript">
    var n2 = wk.uploads({num:3,type:'png,jpg,jpeg',attr:2,status:'update',url:"{:url('admin/upload/upload')}"})
    var n3 = wk.uploads({num:3,type:'png,jpg,jpeg',attr:3,status:'update',url:"{:url('admin/upload/upload')}"})
    var n4 = wk.uploads({num:3,type:'png,jpg,jpeg',attr:4,status:'update',url:"{:url('admin/upload/upload')}"})
    function imgDel2(e,obj,hid,del){
        wk.update_del(e,obj,hid,del,n2);
    }
    function imgDel3(e,obj,hid,del){
        wk.update_del(e,obj,hid,del,n3);
    }
    function imgDel4(e,obj,hid,del){
        wk.update_del(e,obj,hid,del,n4);
    }
    var map = new AMap.Map("container", {
        resizeEnable: true
    });
    var autoOptions = {
        input: "tipinput"
    };
    var auto = new AMap.Autocomplete(autoOptions);
    var placeSearch = new AMap.PlaceSearch({
        map: map
    });
    AMap.event.addListener(auto, "select", select);
    function select(e) {
        placeSearch.setCity(e.poi.adcode);
        placeSearch.search(e.poi.name);
        var lng = e.poi.location.lng;   //获取经度
        var lat = e.poi.location.lat;   //获取纬度
        var address = e.poi.district+e.poi.name;   //获取纬度
        $('input[name=order_go_address]').val(address);
        $('input[name=order_go_lon]').val(lng);
        $('input[name=order_go_lat]').val(lat);
    }
    AMap.event.addListener(placeSearch, "markerClick", addasd)

    function addasd(e) {
        $('input[name=order_go_address]').val(e.data.pname+e.data.cityname+e.data.adname+e.data.name);
        $('input[name=order_go_lon]').val(e.data.location.lng);
        $('input[name=order_go_lat]').val(e.data.location.lat);
    }
</script>

<!--报到地址-->
<script type="text/javascript">

    var map1 = new AMap.Map("container1", {
        resizeEnable: true
    });

    var autoOptions1 = {
        input: "tipinput1"
    };

    var auto1 = new AMap.Autocomplete(autoOptions1);
    var placeSearch1 = new AMap.PlaceSearch({
        map: map1
    });
    AMap.event.addListener(auto1, "select", select1);
    function select1(e) {
        placeSearch1.setCity(e.poi.adcode);
        placeSearch1.search(e.poi.name);
        var lng = e.poi.location.lng;   //获取经度
        var lat = e.poi.location.lat;   //获取纬度
        var address = e.poi.district+e.poi.name;   //获取纬度
        $('input[name=order_to_address]').val(address);
        $('input[name=order_to_lon]').val(lng);
        $('input[name=order_to_lat]').val(lat);
    }
    AMap.event.addListener(placeSearch1, "markerClick", addasd1);

    function addasd1(e) {
        $('input[name=order_to_address]').val(e.data.pname+e.data.cityname+e.data.adname+e.data.name);
        $('input[name=order_to_lon]').val(e.data.location.lng);
        $('input[name=order_to_lat]').val(e.data.location.lat);
    }
</script>

<script>
    //    var editor = wk.wang({elem:'#LAY_editor'});
    wk.uploadImg({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:""});
    layui.use(['form','upload','layedit','laydate'], function() {
        var form = layui.form;
//        form.verify({
//            editor:function(value,item){
//                if(editor.txt.html() == '<p><br></p>'){
//                    return '请填写内容';
//                }
//            }
//        });
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('update')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('order/index')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            });

        });
        var laydate = layui.laydate;
        //同时绑定多个
        lay('.test-item').each(function(){
            laydate.render({
                elem: this
                ,format:'yyyy-MM-dd HH:mm:ss'
                ,type:'datetime'
                ,trigger: 'click'
            });
        });
    });
</script>

</body>
</html>
